<div style="margin-top:80px;margin-left:80px;width:520px;height:240px;background-color:#F7F7F7;padding-top:20px;padding-left:140px;">
    <span style="margin-left:120px;"><font size="5" color="#6F0886"><b>库位解除</b></font></span>
    <table width="300px;" style="margin-top:18px;" id="formissue">
        <tr height="38px"><td>请输入库位号：</td><td><input type="text" name="locationNo" id="locationNo" ></td></tr>
        <tr height="32px;"  id="restr">
            <td colspan="2"><div id="restext" style="font-size:16px;padding-left:18px;"></div> </td>
        </tr>
        <tr height="52px" id="bang" align="center">
            <td>
                <input type="button" name="button" id="removeLocation" value="解除" style="background-color: #FF8312;width: 68px;height: 32px;color: white;font-size: 16px;border-radius:8px;cursor: pointer;"/>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
        $("#locationNo").focus();
        var ckremove = false;
        $("#removeLocation").live("click",function(){
            var locationNo = $("#locationNo").val();
            if(confirm("您确定解绑仓库位（"+locationNo+"）？","提示信息")){   
                if(ckremove){
                    $.ajax({    
                        type: 'POST',
                        url: '/admini/managestore/removelocation/locationNo/'+locationNo,
                        success: function(data) {
                            if(data == 1){
                                $("#restext").html("解绑成功！");
                                $("#locationNo").val("");
                            }else{
                                $("#restext").html("出现未知错误！");
                                return false;
                            }
                        }
                    });
               }else{
                   alert("该仓库位错误或者没有绑定用户，无法解绑！");
                   return false;
               }
            }
            $("#locationNo").focus();
        });
        $('#locationNo').focusout(function(){
            var locationNo = $("#locationNo").val();
            var arrno = locationNo.split("-");
            $("#restr").attr("style","background-color: rgb(124, 242, 139);");
            if(arrno[0].length == 2 && arrno[1].length == 2){
                $.ajax({    
                    type: 'POST',
                    url: '/admini/managestore/locationinfo/locationNo/'+locationNo,
                    success: function(data) {
                        if(data == 0){
                            $("#restext").html("该仓库位不存在！");
                            ckremove = false;
                        }else{
                            if(data.status == 2){
                                $("#restext").html("该仓库位不可用！");
                                ckremove = false;
                            }else if(data.status == 0){
                                $("#restext").html("该仓库位没有绑定用户！");
                                ckremove = false;
                            }else{                            
                                $("#restext").html("该仓库位已经绑定用户！<br>用户名："+data.username+"&nbsp;&nbsp;仓库号："+data.storeno);
                                ckremove = true;
                            }
                        }
                    }
                });
            }else{
                $("#restext").html("仓库位格式有误，请重新输入！");
                ckremove = false;
            }
            $("#locationNo").focus();
        });
        $('#locationNo').keyup(function(e){
            if(e.keyCode ==13){
                var locationNo = $("#locationNo").val();
                var arrno = locationNo.split("-");
                $("#restr").attr("style","background-color: rgb(124, 242, 139);");
                if(arrno[0].length == 2 && arrno[1].length == 2){
                    $.ajax({    
                        type: 'POST',
                        url: '/admini/managestore/locationinfo/locationNo/'+locationNo,
                        success: function(data) {
                            if(data == 0){
                                $("#restext").html("该仓库位不存在！");
                                ckremove = false;
                            }else{
                                if(data.status == 2){
                                    $("#restext").html("该仓库位不可用！");
                                    ckremove = false;
                                }else if(data.status == 0){
                                    $("#restext").html("该仓库位没有绑定用户！");
                                    ckremove = false;
                                }else{                            
                                    $("#restext").html("该仓库位已经绑定用户！<br>用户名："+data.username+"&nbsp;&nbsp;仓库号："+data.storeno);
                                    ckremove = true;
                                }
                            }
                        }
                    });
                }else{
                    $("#restext").html("仓库位格式有误，请重新输入！");
                    ckremove = false;
                }
                $("#locationNo").focus();
            }
    });
</script>